def sort_books(books):
    sorted_books = sorted(books, key=lambda book: (book['year'],book['title']))
    return sorted_books


if __name__ == "__main__":
    books = [
        {"title": "Python编程", "author": "张三", "year": 2020, "isbn": "1234567890"},
        {"title": "算法导论", "author": "李四", "year": 2018, "isbn": "0987654321"},
        {"title": "数据结构", "author": "王五", "year": 2020, "isbn": "1122334455"},
        {"title": "机器学习", "author": "赵六", "year": 2019, "isbn": "5566778899"},
        {"title": "人工智能", "author": "钱七", "year": 2018, "isbn": "6677889900"}
    ]

    print("=== 排序前的书籍列表 ===")
    for book in books:
        print(f"《{book['title']}》 - {book['author']} - {book['year']}")

    # 排序书籍
    sorted_books = sort_books(books)

    print("\n=== 排序后的书籍列表 ===")
    for book in sorted_books:
        print(f"《{book['title']}》 - {book['author']} - {book['year']}")